package cn.com.jenson.web.main.controller;

import cn.com.jenson.common.BasicController;
import cn.com.jenson.common.ImportVerifierVo;
import cn.com.jenson.common.Result;
import cn.com.jenson.common.SelectVo;
import cn.com.jenson.entity.main.SetMeal;
import cn.com.jenson.service.main.service.SetMealService;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/api/main/set_meal")
public class SetMealController implements BasicController<SetMeal, SetMeal, SetMeal> {

    @Resource
    SetMealService setMealService;

    @Override
    public Result<Page<SetMeal>> pageAll(@RequestBody SetMeal setMeal) {
        return Result.suc(setMealService.pageAll(setMeal));
    }

    @Override
    public Result<List<SetMeal>> listAll(@RequestBody SetMeal setMeal) {
        return Result.suc(setMealService.listAll(setMeal));
    }

    @Override
    public Result<SetMeal> get(@RequestBody SetMeal setMeal) throws InstantiationException, IllegalAccessException {
        return Result.suc(setMealService.get(setMeal));
    }

    @Override
    public Result<SetMeal> edit(@RequestBody SetMeal setMeal) throws InstantiationException, IllegalAccessException {
        return Result.suc(setMealService.edit(setMeal));
    }

    @Override
    public Result<List<SetMeal>> editAll(@RequestBody List<SetMeal> setMeals) {
        return Result.suc(setMealService.editAll(setMeals));
    }

    @Override
    public Result<SetMeal> deleted(@RequestBody SetMeal setMeal) throws InstantiationException, IllegalAccessException {
        return Result.suc(setMealService.deleted(setMeal));
    }

    @Override
    public Result<List<SetMeal>> deletedAll(@RequestBody List<SetMeal> setMeals) throws InstantiationException, IllegalAccessException {
        return Result.suc(setMealService.deletedAll(setMeals));
    }

    @Override
    public List<ImportVerifierVo> importTemplateVerifiers() {
        return null;
    }

    @Override
    public void importTemplateDownload(HttpServletResponse response) throws IOException {

    }

    @Override
    public Result<List<SelectVo<String, Integer, SetMeal>>> option() {
        return null;
    }
}
